jQuery.validator.addMethod("isP", function(value, element) {
    return !($("#promise").is(":checked") && value=="");
}, "请输入酬金金额");
jQuery.validator.addMethod("isPhone", function(value, element) {
    var length = value.length;
    var mobile = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/;
    return length == 11 && mobile.test(value) || value=="";
}, "请填写正确的手机号码");//可以自定义默认提示信息
var ret="true";
$("body").on("input","#random",function(){
    if($("#random").val().length==5){
        $.ajax({
            type:"POST",
            url:"/checkRandom",
            data:{"random":$("#random").val()},
            success : function(result) {
                ret=result;
                if(ret=="false")
                {
                    $("#random").blur();
                    $("#randomcodeimg").attr("src","/randomcode?t="+new Date().getTime());
                }
            }
        });

    }
});
jQuery.validator.addMethod("isLen", function(value, element) {
    return value.length==5;
}, "验证码长度不正确");
jQuery.validator.addMethod("isPass", function(value, element) {
    return ret=="true";
}, "验证码错误");
$("#test").validate();
$("body").on("click","#promise",function(){
    if($("#promise").is(":checked")){
        $("#test").validate().element($("#remuneration"));
    }else{
        if($("#remuneration").val()==""){
            $("#remuneration-error").remove();
        }
    }
});